<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="赵鹤阳">
    <title>选项卡</title>
    <style>
        .box {
            width: 400px;
            border: 1px solid #000;
            margin: 50px auto;
        }

        .option {
            margin: 0;
            padding: 0;
            list-style: none;
            background-color: #000;
        }

        .option li {
            float: left;
            width: 60px;
            text-align: center;
            line-height: 26px;
            color: white;
        }

        .option::after {
            content: '';
            clear: both;
            display: block;
            height: 0;
            visibility: hidden;
        }

        .active {
            color: black;
            background-color: #aaa;
        }

        p {
            display: none;
            text-align: center;
        }

        p:first-child {
            display: block;
        }
    </style>
</head>

<body>
    <div class="box">
        <ul class="option">
            <li class="active">选项1</li>
            <li>选项2</li>
            <li>选项3</li>
        </ul>
        <div class="content">
            <p>内容一 <br>内容二 <br>内容三 <br>内容四 <br>内容五</p>
            <p>内容一 <br>内容二 <br>内容三 </p>
            <p>内容三 <br>内容四 <br>内容五</p>
        </div>
    </div>
    <script src="./jquery.js"></script>
</body>

</html>
<script>
    // var index = 0;
    $('li').each(function (index) {
        $(this).mouseover(function () {
            $('li').eq(index).css({ 'color': 'black', 'background-color': '#aaa' })
                .siblings().css({ 'color': 'white', 'background-color': 'black' });
            $('p').eq(index).css('display', 'block')
                .siblings().css('display', 'none');
        });

    });

</script>